package com.eedi.framework.permission.enums;

import com.eedi.framework.common.enums.BaseEnum;
import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
public enum OrgRoleTypeEnum implements BaseEnum<Integer,String> {

    /**
     * 系统默认
     */
    SYSTEM(1,"系统默认"),
    /**
     * 自定义新增
     */
    CUSTOM(2,"自定义新增");

    private final Integer code;

    private final String desc;

    OrgRoleTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static OrgRoleTypeEnum getByCode(Integer code) {
        for (OrgRoleTypeEnum orgRoleType : values()) {
            if (orgRoleType.getCode().equals(code)) {
                return orgRoleType;
            }
        }
        throw new IllegalArgumentException("Invalid gender code: " + code);
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    @Override
    public String title() {
        return "机构角色类型";
    }
}
